<template>
	<view class="tabber-home">
		<view class="swiper_wrap fix-nav">
			<!-- <u-swiper :list="swiper_list" height="450"></u-swiper> -->
			<view class="heg-jr" :style="{ height: statusBarHeight + 'px' }">

			</view>
			<view class="header" :style="{ top: statusBarHeight + 'px' }">
				<view class="region">
					<text class="iconfont iconweizhi"></text>
				</view>
				<view class="" @click="cutCity" style="padding-top: 10rpx; padding-right: 30rpx;">
					<text class="top-address">{{ city || '未定位' }}</text>
					<u-icon style="display: inline-block; padding-left: 10rpx;" name="arrow-down"></u-icon>
				</view>
				<view class="search" @click="erpClick">
					<u-search :show-action="false" :disabled="true" placeholder="请输入企业名称" v-model="keyword"></u-search>
				</view>
			</view>

		</view>
		<!-- 快捷入口 -->
		<view class="quick_box">
			<view class="item" @click="toPath('/pages/receivingMaterials/index')">
				<view class="name">收料信息发布</view>
				<view class="des">收料 发单一键
					<view style="margin-top: 8rpx;">轻松解决</view>
				</view>
				<image class="icon" :src="getStaticFilePath('home/nav/shouliao.png')" mode=""></image>
			</view>
			<view class="right">
				<view class="" @click="msgFbClick">
					<image :src="getStaticFilePath('/home/quick/masg1.png')" mode="">
					</image>
				</view>
			</view>
		</view>
		<!-- 宫格 -->
		<view class="grid-box">
			<u-grid :col="4" :border="false">
				<u-grid-item :custom-style="customStyle" @click="erpClick">
					<u-icon :name="getStaticFilePath('/home/nav/nav-HY.png')" :size="98">
					</u-icon>
					<view class="grid-text" style="margin-top: 8rpx;">货源厂家</view>
				</u-grid-item>

				<u-grid-item :custom-style="customStyle" @click="chongzhi">
					<u-icon :name="getStaticFilePath('/home/nav/nav-CZ.png')" :size="106">
					</u-icon>
					<view class="grid-text" style="margin-top: -3rpx;">充值</view>
				</u-grid-item>
				<u-grid-item :custom-style="customStyle" @click="ksxdClick">
					<u-icon :name="getStaticFilePath('/home/nav/nav-KSXD.png')" :size="106">
					</u-icon>
					<view class="grid-text" style="margin-top: 6rpx;">快速下单</view>
				</u-grid-item>
				<u-grid-item :custom-style="customStyle" @click="stayPayFun">
					<u-icon :name="getStaticFilePath('/home/nav/nav-DZF.png')" :size="103">
					</u-icon>
					<view class="grid-text" style="margin-top: 2rpx;">待支付订单</view>
					<u-badge type="error" :count="dzfNum"></u-badge>
				</u-grid-item>
				<u-grid-item :custom-style="customStyle" @click="hyClick">
					<u-icon :name="getStaticFilePath('/home/nav/nav-infoList.png')" style="margin-top: 12rpx;"
						:size="80">
					</u-icon>
					<view class="grid-text" style="margin-top: 15rpx;">配送信息</view>
				</u-grid-item>
				<u-grid-item :custom-style="customStyle" @click="freightRecordClick">
					<u-icon :name="getStaticFilePath('/home/nav/nav-YF.png')" :size="106">
					</u-icon>
					<view class="grid-text">配送记录</view>
				</u-grid-item>
				<!-- <u-grid-item v-if="AuthorizationOBJ.ORMTB417CA06 != 0" :custom-style="customStyle" @click="ewmClick">
					<u-icon :name="getStaticFilePath('/home/nav/nav-ewmicon.png')" :size="100">
					</u-icon>
					<view class="grid-text" style="margin-top: 2rpx;">提货码</view>
				</u-grid-item> -->
				<u-grid-item :custom-style="customStyle" @click="searchFuelCardclick">
					<u-icon :name="getStaticFilePath('/home/nav/nav-YK.png')" :size="98">
					</u-icon>
					<view class="grid-text" style="margin-top: 2rpx;">我要加油</view>
				</u-grid-item>
				<u-grid-item :custom-style="customStyle" @click="moreClick">
					<u-icon :name="getStaticFilePath('/home/nav/nav-more.png')" style="margin-top: 12rpx;" :size="80">
					</u-icon>
					<view class="grid-text" style="margin-top: 14rpx;">更多</view>
				</u-grid-item>
			</u-grid>
		</view>
		<!-- 优惠券-->
		<u-popup class="tanchuang" v-model="show" mode="center" border-radius="10" length="90%"
			:mask-close-able="false">
			<view class="progress-wrap">
				<view class="">
					<view class="popup_title">
						恭喜您注册完成
					</view>
					<view class="popup_title">
						送您五张优惠券赶快下单使用吧!
					</view>
				</view>
				<view class="quan-bg" v-for="(item, index) in couponList" :key="index">
					<view class="quan-jine">
						<text class="jine-fuhao">￥</text>
						<text class="jine">{{ item.settb409CA01 }}</text>
						<view class="">
							<text>
								通用券
							</text>
						</view>
					</view>
					<view class="quan-jieshao-content">
						<view class="">
							<text class="quan-tit-cont">{{ item.settb409CA00 }}</text>
						</view>
						<view class="quan-jz-riqi">
							<text>2023-04-15<text style="padding-left:5rpx; color:#FF4500;">到期</text></text>
						</view>
					</view>
				</view>
				<view class="but-lj-lq">
					<u-button @click="shiyongYHQFun()" class="sub-lq" type="error" text="确定">立即使用</u-button>
				</view>
			</view>
		</u-popup>
		<!-- 公告 -->
		<view class="notice">
			<u-notice-bar font-size="38" color="#333" mode="horizontal" :list="notice_list"></u-notice-bar>
		</view>
		<!-- 选项卡 -->
		<view class="u-tabs-box">
			<u-tabs-swiper font-size="32" style="padding-bottom: 20rpx;" activeColor="#058cff" ref="tabs"
				:list="tabs_list" :current="current" @change="change" :is-scroll="false" swiperWidth="750">
			</u-tabs-swiper>
		</view>
		<view class="wrap">
			<swiper class="swiper-box" :current="current" @transition="transition" @animationfinish="animationfinish">
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<view class="order" v-for="(item, index) in orderList" :key="index" @click="goAndSee(item)">

								<view class="item">
									<view class="left">
										<image :src="item.SETTB99CA03 || getStaticFilePath('home/nav/noerpimg.png')"
											mode="aspectFill">
										</image>
									</view>
									<view class="content">
										<view class="title u-line-2"
											style="display: flex;justify-content: space-between;">
											<text>{{ item.SETTB99CA00 }}</text>

											<text style="color:red;">{{ item.mdj || '' }}</text>
										</view>
										<view class="type">{{ item.SETTB99CA02 }}</view>
										<!-- <u-button type="primary" class="btn_mid" >去看看</u-button> -->
										<view class="see-btn">
											<!-- <view class="see-btn-collection" @click="collCancelClick(item)"  v-if="item.SETTB403ID!=''">
												<text class="iconfont iconshoucang"></text>取消收藏
											</view> -->
											<view class="see-btn-collection" @click.stop="collClick(item)"
												v-if="item.SETTB403ID == ''">
												<text class="iconfont iconshoucangqiye"></text>收藏

											</view>
											<view class="see-btn-collection" style="color:#f60" v-else>已收藏</view>
											<text v-if="item.flag == '1'" class="kyq-bs">可使用券</text>
										</view>
									</view>
								</view>
							</view>
							<u-loadmore v-if="orderList.length != 0" :status="status" :icon-type="iconType"
								:load-text="loadText" />
							<view class="zanWSJ" v-if="orderList.length == 0">
								<image :src="getStaticFilePath('/QXY/noData.png')" alt=""></image>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<!-- v-if="collectionList.length" -->
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottomColl">
						<view class="page-box">
							<view class="order" v-for="(res, indexs) in collectionList" :key="indexs"
								@click="goAndSee(res)">
								<view class="item">
									<view class="left">
										<image :src="res.SETTB99CA03 || getStaticFilePath('home/nav/noerpimg.png')"
											mode="aspectFill">
										</image>
									</view>
									<view class="content">
										<view class="title u-line-2">{{ res.SETTB99CA00 }}</view>
										<view class="type">{{ res.SETTB99CA02 }}</view>
										<view class="see-btn">
											<view class="see-btn-collection" @click.stop="collCancelClick(res)">
												<text class="iconfont iconshoucang"></text>取消收藏
											</view>
										</view>
									</view>
								</view>
							</view>
							<u-loadmore v-if="collectionList.length != 0" :status="status" :icon-type="iconType"
								:load-text="loadText" />
							<!-- 缺醒页 -->
							<view class="zanWSJ" v-if="collectionList.length == 0">

								<image :src="getStaticFilePath('/QXY/noData.png')" alt=""></image>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
		<u-popup v-model="showCJ" mode="center" :closeable="true" border-radius="10" @close="closeCJ" @open="openCJ"
			length="80%" :mask-close-able="false">
			<view class="tanchuang" style="padding:30rpx;">
				<view class="" style="text-align: center; color: #FF4500;">
					<text>公告</text>
				</view>
				<view style="padding-bottom: 30rpx;padding-top: 20rpx; text-align: left;">
					<!-- <p><text>{{hdgg}}</text></p>
					 -->
					<u-parse :html="hdgg"></u-parse>
				</view>

				<view class="but-lj-lqgg">
					<view class="qx-style-gg">
						<u-button @click="closeCJ()" class="sub-lq" type="error">取消</u-button>
					</view>
					<view class="">
						<u-button @click="funBut()" class="sub-lq" type="success">确定</u-button>
					</view>
				</view>
			</view>
		</u-popup>
		<u-toast ref="uToast" />
		<u-modal v-model="collShow" :content="collShowContent" :show-cancel-button="true" @confirm="collConfirm">
		</u-modal>
	</view>
</template>

<script>
	// import authorizeUtils from "../../../util/authorizeUtils.ts"

	export default {
		data() {
			return {
				userinfo: JSON.parse(uni.getStorageSync('userinfo')),
				// mapkey: 'OQABZ-WYMCX-KGM4O-TJ5OA-X7MQZ-J5BQE',
				// mapkey: '3NYBZ-WRL3Z-V3VXL-ZYUPM-SSP6J-S2BBJ',//腾讯地图app端key
				// mapkey: 'NNOBZ-OUGWC-WV42K-AOHNT-4OVRZ-DMBMX',//腾讯地图app端key
				status: 'loading',
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
				city: "",
				cityCode: '',
				address: '',
				collShow: false,
				SETTB99ID: '',
				SETTB403ID: '',
				collShowIndex: 0,
				collShowContent: '',
				//宫格自定义样式
				customStyle: {
					padding: '10rpx 0'
				},
				title: 'Hello',
				keyword: '',
				//轮播图
				swiper_list: [{
					image: 'https://feishazoushi.cn/appImages/images/home/swiper/swiper1.png',
					title: ''
				}],
				//公告
				notice_list: [

				],
				//选项卡
				orderList: [],
				collectionList: [],
				tabs_list: [{
						name: '厂家'
					},
					{
						name: '收藏'
					}
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
				countpage: 1,
				page: 1,
				pageColl: 1,
				countpageColl: 1,
				AuthorizationOBJ: '',
				show: false,
				show_index_big_pic: false,
				couponList: [],
				mydata: {
					binary: '',
					queryCodeList: ''
				},
				hdgg: '',
				showCJ: false,
				statusBarHeight: 0,
				dzfNum: '',
			}
		},
		onLoad(ops) {

			if (uni.getStorageSync('popUp-show-time')) {
				let hcsjdb
				let hcsjSet
				hcsjdb = uni.getStorageSync('popUp-show-time')
				let a = new Date().getTime()

				if (!hcsjdb || new Date().getTime() - hcsjdb > 1000 * 60 * 60 * 24) {
					// console.log('更新时间')
					hcsjSet = new Date().getTime()
					uni.setStorageSync('popUp-show-time', hcsjSet)
					this.showCJ = false;
				}
			}
			if (!uni.getStorageSync('popUp-show-time')) {
				// console.log('没有')
				let setsj = new Date().getTime()
				uni.setStorageSync('popUp-show-time', setsj)
			}

			const info = uni.getSystemInfoSync()
			if (info.osName == 'android') {
				this.statusBarHeight = info.statusBarHeight + 8
			} else {
				//设置状态栏高度
				this.statusBarHeight = info.statusBarHeight
			}


			this.yhqListFun()
			this.gonggaoFun()
			this.gonghdgaoFun()
			this.dzfddFun()
			// this.queryCity()
		},
		onShow: function() {


			if (this.userinfo.sign == 'CUS-3') {
				this.queryAuthorization()
			}
			uni.removeStorageSync('Erptype')
			uni.removeStorageSync('erpinfo')
			if (uni.getStorageSync('city')) {
				this.address = JSON.parse(uni.getStorageSync('city'))
			}
			console.log(this.address)
			if (!this.address) {
				this.queryCity()
				console.log('未定位')
			} else {
				this.city = this.address.CODETB01CA01
				this.cityCode = this.address.CODETB01CA00
				if (uni.getStorageSync('tj')) {
					this.orderList = []
					this.page = 1
					this.countpage = 1
					this.collectionList = []
					this.pageColl = 1
					this.countpageColl = 1
					this.getCollectionList();
					uni.removeStorageSync('tj');
				}

				this.getOrderList(this.cityCode);
			}


		},
		methods: {
			openCJ() {
				this.showCJ = true
			},
			closeCJ() {
				this.showCJ = false
			},
			funBut() {
				this.closeCJ()
			},
			stayPayFun() {
				uni.navigateTo({
					url: '/pages/wallet/stayPay/index'
				})
			},
			dzfddFun() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/orm/ormtb442/selectUnPayCount',
					method: 'POST',
					dataType: 'json',
					data: {
						ORMTB442CA02: this.userinfo.ORMTB410ID //二级客户ID
					},
					success: (res) => {
						// console.log(res);
						uni.hideLoading();
						if (res.data.code == 200) {
							var data = res.data.data
							// console.log(data)
							this.dzfNum = data
							if (this.dzfNum >= 1) {
								uni.showModal({
									title: '待支付订单',
									content: '您有待支付订单请前往支付',
									success: (res) => {
										// 这里需要根据业务需求处理，一般情况下会引导用户前往赚取金币的页面
										if (res.confirm) {
											uni.navigateTo({
												url: '/pages/wallet/stayPay/index'
											})
										} else {}
									},
									complete: () => {}
								})
							}
						} else {
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
					},
					fail: (res) => {
						// console.log(res)
						uni.hideLoading();
						uni.showToast({
							title: res.data.message,
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			open() {
				this.show = true
				uni.request({
					url: this.baseUrl + '/orm/ormtb410/selectCoupons',
					method: 'POST',
					dataType: 'json',
					data: {
						ORMTB410ID: this.userinfo.ORMTB410ID,
					},
					success: (res) => {
						if (res.data.code == 200) {
							// console.log(res)
							this.couponList = res.data.data
						} else {
							uni.removeStorageSync('city')
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
					},
					fail: (res) => {
						uni.showToast({
							title: '服务器连接超时',
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			close() {
				this.show = false
			},
			yhqListFun() {
				uni.request({
					url: this.baseUrl + '/orm/ormtb410/getDraw',
					method: 'POST',
					dataType: 'json',
					data: {
						ORMTB410ID: this.userinfo.ORMTB410ID,
					},
					success: (res) => {
						if (res.data.code == 200) {
							// console.log(res)
							if (res.data.data == 0) {
								this.open()
							}
						} else {
							uni.removeStorageSync('city')
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
					},
					fail: (res) => {
						uni.showToast({
							title: '服务器连接超时',
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			shiyongYHQFun() {
				uni.request({
					url: this.baseUrl + '/orm/ormtb410/setDraw',
					method: 'POST',
					dataType: 'json',
					data: {
						ORMTB410ID: this.userinfo.ORMTB410ID,
					},
					success: (res) => {
						if (res.data.code == 200) {
							// console.log(res)
							this.close()
							uni.navigateTo({
								url: '/pages/SOenterprise/index'
							})
						} else {
							uni.removeStorageSync('city')
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
					},
					fail: (res) => {
						uni.showToast({
							title: '服务器连接超时',
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			queryAuthorization() { //查询子账户权限
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/orm/ormtb417/selectAccess/' + this.userinfo.ORMTB417ID,
					method: 'GET',
					success: (res) => {
						uni.hideLoading();
						if (res.data.code == 200) {
							this.AuthorizationOBJ = res.data.data
						} else {
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon: false
							})
						}
					},
					fail: (res) => {
						uni.hideLoading();
						this.$refs.uToast.show({
							title: '服务器连接超时',
							type: 'default',
							icon: false
						})
					}
				});
			},
			queryCity() {
				var that = this
				uni.getLocation({
					type: 'gcj02',
					success: function(res) {
						console.log('当前位置的经度：' + res.longitude);
						console.log('当前位置的纬度：' + res.latitude);
						uni.request({
							url: `https://apis.map.qq.com/ws/geocoder/v1/?key=${that.mapkey}&location=${res.latitude},${res.longitude}`,
							method: 'GET',
							success: (res) => {
								console.log(res)
								that.city = res.data.result.address_component.city
								that.queryCityCode()
							},
							fail: (res) => {
								uni.showToast({
									title: '服务器连接超时',
									duration: 5000,
									icon: 'none',
								});
							}
						});
					}
				});
			},
			queryCityCode() {
				uni.request({
					url: this.baseUrl + '/code/condtb01/selecList',
					method: 'POST',
					dataType: 'json',
					data: {
						CODETB01CA01: this.city,
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.cityCode = res.data.data[0].CODETB01CA00
							this.getOrderList();
							var str = JSON.stringify(res.data.data[0])
							uni.setStorageSync('city', str);
						} else {
							uni.removeStorageSync('city')
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
					},
					fail: (res) => {
						uni.showToast({
							title: '服务器连接超时',
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			toPath(url) {
				console.log(`output->url`, url)
				uni.navigateTo({
					url: url
				})
			},
			erpClick() {
				uni.navigateTo({
					url: '/pages/SOenterprise/index'
				})
			},
			chongzhi() {
				uni.navigateTo({
					url: '/pages/accountOnlineRecharge/index'
				})
			},
			msgFbClick() {
				uni.navigateTo({
					url: '/pages/msgFb/index'
				})
			},
			cutCity() {
				uni.navigateTo({
					url: '/pages/Crity/index'
				})
			},
			hyClick() {
				uni.navigateTo({
					url: '../../masgList/index'
				})
			},
			freightRecordClick() {
				uni.navigateTo({
					url: '/pages/yunfeiMaseg/wdyfdd/index'
				})
			},
			ewmClick() {
				uni.navigateTo({
					url: `${'/pages/ewm/index'}`
				})
			},
			searchFuelCardclick() {
				uni.navigateTo({
					url: '/pages/fuelCard/index'
				})
			},
			moreClick() {
				uni.navigateTo({
					url: '/pages/shouquan/more/more'
				})
			},
			ksxdClick() {
				uni.navigateTo({
					url: '/pages/daiOrde/ksxd/index'
				})
			},
			gonggaoFun() {
				this.notice_list = []
				uni.request({
					url: this.baseUrl + '/set/settb99/selectGG',
					method: 'POST',
					dataType: 'json',
					data: {},
					success: (res) => {
						if (res.data.code == 200) {
							// console.log(res.data)
							this.notice_list.push(res.data.data)
							this.hdgg = res.data.data

						} else {
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
					},
					fail: (res) => {
						uni.showToast({
							title: '服务器连接超时',
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			gonghdgaoFun() {
				uni.request({
					url: this.baseUrl + '/set/settb99/selectTC',
					method: 'POST',
					dataType: 'json',
					data: {},
					success: (res) => {
						if (res.data.code == 200) {
							// console.log(res.data)
							this.hdgg = res.data.data
						} else {
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
					},
					fail: (res) => {
						uni.showToast({
							title: '服务器连接超时',
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			//收藏
			collClick(item) {
				this.collShow = true
				this.SETTB99ID = item.SETTB99ID
				this.collShowIndex = 1
				this.collShowContent = `请确认是否添加收藏:${item.SETTB99CA00}`
			},
			collClickPost() {
				uni.request({
					url: this.baseUrl + '/set/settb403/collect',
					method: 'POST',
					dataType: 'json',
					data: {
						PERTB005ID: this.userinfo.PERTB005ID, //用户ID
						SETTB99ID: this.SETTB99ID, //二级企业id
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.$refs.uToast.show({
								title: '收藏成功',
								type: 'default',
								icon: false
							})
							if (this.current == 0) {
								this.orderList = []
								this.getOrderList();
							} else {
								this.collectionList = []
								this.getCollectionList()
							}
						} else {
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon: false
							})
						}
					},
					fail: (res) => {
						this.$refs.uToast.show({
							title: '服务器连接超时',
							type: 'default',
							icon: false
						})
					}
				});
			},
			collConfirm() {
				if (this.collShowIndex == 1) {
					this.collClickPost()
				} else if (this.collShowIndex == 2) {
					this.collCancelClickPost()
				}
			},
			//取消收藏
			collCancelClick(item) {
				this.collShow = true
				this.SETTB403ID = item.SETTB403ID
				this.collShowIndex = 2
				this.collShowContent = `请确认是否取消收藏:${item.SETTB99CA00}`
			},
			collCancelClickPost() {
				uni.request({
					url: this.baseUrl + '/set/settb403/delete',
					method: 'POST',
					dataType: 'json',
					data: {
						SETTB403CA00: this.userinfo.PERTB005ID, //用户ID
						SETTB403ID: this.SETTB403ID, //收藏id
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.$refs.uToast.show({
								title: '取消成功',
								type: 'default',
								icon: false
							})
							if (this.current == 0) {
								this.orderList = []
								this.getOrderList();
							} else {
								this.collectionList = []
								this.getCollectionList()
							}
						} else {
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon: false
							})
						}
					},
					fail: (res) => {
						this.$refs.uToast.show({
							title: '服务器连接超时',
							type: 'default',
							icon: false
						})
					}
				});
			},



			// 企业列表  
			getOrderList() {
				uni.showLoading({
					title: '请求中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/set/settb99/selectPageList',
					method: 'POST',
					dataType: 'json',
					data: {
						SETTB403CA00: this.userinfo.PERTB005ID,
						ORMTB410ID: this.userinfo.ORMTB410ID,
						ORMTB400ID: this.userinfo.ORMTB400ID, //一级客户ID
						SETTB99CA00: '', //二级企业名称
						SETTB100CA04: this.cityCode, //市代码
						page: this.page,
						limit: 10,
					},
					success: (res) => {
						uni.hideLoading();
						if (res.data.code == 200) {
							// console.log(res)
							if (!res.data.data || res.data.data == null) {
								this.orderList = []
								this.page = 1
								this.countpage = 1
								return
							}
							if (this.page > 1) {
								let arr = [...this.orderList, ...res.data.data]

								// let newarr = new Set(arr)

								const uniqueArray = arr.filter((obj, index, self) =>
									index === self.findIndex((o) => (
										o.SETTB99ID === obj.SETTB99ID
									))
								);
								// console.log(uniqueArray)

								this.orderList = uniqueArray

							} else {
								this.orderList = res.data.data
							}
						} else {
							this.orderList = []
							this.page = 1
							this.countpage = 1
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon: false
							})
						}
						if (this.countpage == this.page) {
							this.status = "nomore"
						} else {
							this.status = "loadmore"
						}
						this.countpage = Math.ceil(res.data.count / 10)
						this.getCollectionList();
					},
					fail: (res) => {
						if (this.countpage == this.page) {
							this.status = "nomore"
						} else {
							this.status = "loadmore"
						}
						uni.hideLoading();
						this.$refs.uToast.show({
							title: '服务器连接超时',
							type: 'default',
							icon: false
						})
					}
				});
			},
			// 收藏列表
			getCollectionList() {
				uni.showLoading({
					title: '请求中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/set/settb403/selectPageList',
					method: 'POST',
					dataType: 'json',
					data: {
						SETTB403CA00: this.userinfo.PERTB005ID, //用户ID
						page: this.pageColl,
						limit: 50,
					},
					success: (res) => {
						uni.hideLoading();
						if (res.data.code == 200) {
							// console.log(res)
							if (!res.data.data || res.data.data == null) {
								this.collectionList = []
								this.pageColl = 1
								this.countpageColl = 1
								return
							}
							// var data = res.data.data || []
							if (this.pageColl > 1) {
								this.collectionList = [...this.collectionList, ...res.data.data]
							} else {
								this.collectionList = res.data.data
							}
							this.countpageColl = Math.ceil(res.data.count / 10)
						} else {
							this.collectionList = []
							this.pageColl = 1
							this.countpageColl = 1
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon: false
							})
						}
						if (this.countpageColl == this.pageColl) {
							this.status = "nomore"
						} else {
							this.status = "loadmore"
						}
					},
					fail: (res) => {
						if (this.countpageColl == this.pageColl) {
							this.status = "nomore"
						} else {
							this.status = "loadmore"
						}
						// uni.hideLoading();
						this.$refs.uToast.show({
							title: '服务器连接超时',
							type: 'default',
							icon: false
						})
					}
				});
			},
			// tab栏切换
			change(index) {
				this.orderList = []
				this.page = 1
				this.countpage = 1
				this.collectionList = []
				this.pageColl = 1
				this.countpageColl = 1
				this.current = index
				if (index == 0) {
					this.getOrderList();
				}
				if (index == 1) {
					this.getCollectionList()
				}
			},
			// swiper-item左右移动，通知tabs的滑块跟随移动
			transition(e) {
				let dx = e.detail.dx;
				this.$refs.tabs.setDx(dx);
			},
			// 由于swiper的内部机制问题，快速切换swiper不会触发dx的连续变化，需要在结束时重置状态
			// swiper滑动结束，分别设置tabs和swiper的状态
			animationfinish(e) {
				let current = e.detail.current;
				this.$refs.tabs.setFinishCurrent(current);
				if (this.current == current) {
					return
				}
				this.current = current;
				// this.swiperCurrent = current;
				if (current == 0) {
					this.getOrderList()
				}
				if (current == 1) {
					this.getCollectionList()
				}
			},
			reachBottom() {
				if (this.page == this.countpage) {
					return this.status = "nomore"
				}
				this.page++
				this.getOrderList()
			},
			reachBottomColl() {
				if (this.pageColl == this.countpageColl) {
					return this.status = "nomore"
				}
				this.pageColl++
				this.getCollectionList()
			},
			goAndSee(item) {
				uni.setStorageSync('Erptype', 2);
				uni.setStorageSync('erpinfo', JSON.stringify(item));
				uni.navigateTo({
					url: '/pages/SOMater/index'
				})
			}
		}
	}
</script>
<style>
	page {
		height: 100%;
		background-color: #f2f2f2;
	}
</style>
<style lang="scss" scoped>
	.progress-wrap {
		padding: 30rpx;
		background-color: #ff9900;
		color: #FFFFFF;
	}

	.popup_title {
		font-size: 30rpx;
		font-weight: 700;
		text-align: center;
		padding-bottom: 20rpx;


		/* padding: 30rpx; */
	}

	.quan-bg {
		background-image: url(../../../static/images/quan-bg.png);
		background-repeat: no-repeat;
		width: 100%;
		height: 130rpx;
		background-size: 100%;
		// display: flex;
		margin: 10rpx 0;
		position: relative;
		// left: 50%;

	}

	.quan-bg .quan-jine {
		color: #ffffff;
		position: absolute;
		width: 212rpx;
		// padding: 10rpx;
		text-align: center;
		top: 0;
		padding: 0 10rpx;


	}

	.quan-jine .jine-fuhao {
		font-size: 28rpx;

	}

	.quan-jine .jine {
		font-size: 60rpx;
	}

	.quan-bg .quan-jieshao-content {
		// width: 70%;
		position: absolute;
		padding-top: 26rpx;
		padding-bottom: 26rpx;
		padding-left: 10rpx;
		padding-right: 10rpx;
		left: 206rpx;
	}

	.quan-jieshao-content .quan-leixing-style {
		background: #FF4500;
		color: #ffffff;
		padding: 10rpx;
		border-radius: 20rpx;
		font-size: 12rpx;
		margin-right: 10rpx;
	}

	.quan-jieshao-content .quan-tit-cont {
		font-size: 30rpx;
		font-weight: bold;
		color: #303133;
	}

	.quan-jz-riqi {
		padding-top: 24rpx;
		color: #999999;

	}

	.quan-text-cj {
		display: flex;
		padding-top: 30rpx;
		font-size: 12rpx;
		justify-content: space-between;
	}

	.quan-kycj {
		width: 400rpx;
		color: #999999;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;

	}

	.but-lj-lq {
		width: 100%;
		margin: 20rpx 0;
		margin-top: 40rpx;
		text-align: center;
		color: #fff;
		left: 50%;
	}

	.but-lj-lqgg {
		width: 100%;
		margin: 20rpx 0;
		margin-top: 40rpx;
		text-align: center;
		color: #fff;
		left: 50%;
		display: flex;
		justify-content: center;
	}

	.see-btn-collection .iconshoucang {
		font-size: 32rpx;
		color: #f4ea2a;
		margin-right: 20rpx;
	}

	.see-btn-collection .iconshoucangqiye {
		font-size: 30rpx;
		color: #999;
		margin-right: 20rpx;
	}

	.see-btn-collection {
		height: 40rpx;
		color: #999;
		font-size: 32rpx;
	}

	.tabber-home .zanWSJ {
		padding-top: 200rpx;
	}

	.tabber-home .zanWSJ>image {
		display: block;
		margin: 0 auto;
		height: 360rpx;
		width: 43%;
	}

	.heg-jr {
		background: #0197f8;
		position: fixed;
		z-index: 999;
		top: 0;
		width: 100%;
	}

	//头部
	.header {
		position: fixed;
		width: 100%;
		z-index: 999;
		display: flex;
		// position: absolute;
		// z-index: 9999;
		// top: 50rpx;
		color: #fff;
		background: #0197f8;
		// padding-left: 24rpx;
		padding-bottom: 30rpx;

		.region {
			// width: 165rpx;
			margin: 15rpx 15rpx 0 25rpx;
			color: #fff;
			display: flex;
		}

		.icon {
			margin-left: 10rpx;
		}

		.search {}
	}

	.top-address {
		padding-left: 10rpx;
	}

	//轮播图
	.swiper_wrap {
		margin-top: -100rpx;

	}

	.fix-nav {
		margin-top: 0;
		min-height: 185rpx;
		background: #0197f8;
		position: relative;
	}

	//快捷入口图片
	.quick_box {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		padding: 18rpx;
		background-color: #FFFFFF;
		vertical-align: top;

		.item {
			// background: #ff9900;
			background: radial-gradient(ellipse at top left, #ff9900 50%, #ffcc00);
			width: 350rpx;
			height: 250rpx;
			border-radius: 25rpx;
			color: #fff;
			font-size: 28rpx;
			padding: 20rpx 30rpx;
			box-sizing: border-box;

			.name {
				font-size: 38rpx;
				font-weight: 400;
				margin-bottom: 8rpx;
			}

			.des {
				line-height: 26rpx;
			}

			.icon {
				width: 88rpx;
				height: 88rpx;
				margin-left: 206rpx;
				margin-top: 4rpx;
			}
		}

		.left {
			width: 350rpx;
			// margin-right: 20rpx;
			vertical-align: top;
			height: 250rpx;

			image {
				width: 350rpx;
				height: 250rpx;
			}
		}

		.right {
			width: 350rpx;
			vertical-align: top;
			height: 250rpx;

			image {
				width: 350rpx;
				height: 250rpx;
			}
		}
	}

	//宫格
	.grid-box {
		padding-bottom: 30rpx;
		background-color: #FFFFFF;

		.grid-text {
			font-size: 32rpx;
			color: $u-type-info;
		}

		.u-grid-item-box {
			text-align: center;
			padding-bottom: 15rpx;

			.icon {
				width: 88rpx;
				height: 88rpx;
				border-radius: 50%;
				background-color: #0197f8;
				margin: 10rpx auto 12rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				// padding-top: 10rpx;
			}
		}
	}

	//公告
	.notice {
		margin: 15rpx 0;
		background-color: #FFFFFF;

		.u-icon__icon {
			color: #ff9900 !important;
		}
	}

	//广告
	.ad_show {
		margin: 10rpx 20rpx;
	}

	//选项卡
	.order {
		// width: 710rpx;
		background-color: #ffffff;
		margin: 10rpx;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		font-size: 28rpx;
		box-shadow: 0px 4rpx 20rpx 4rpx #CDCDCD;

		.top {
			display: flex;
			justify-content: space-between;
			border-bottom-width: 1rpx;
			border-bottom-color: #eee;
			border-bottom-style: solid;
			padding-bottom: 20rpx;

			.left {
				display: flex;
				align-items: center;

				.store {
					margin: 0 10rpx;
					font-size: 28rpx;
					color: #666;
				}
			}

			.right {
				color: #058cff;
			}
		}

		.item {
			display: flex;
			margin: 20rpx 0 0;

			.left {
				margin-right: 30rpx;
				text-align: center;

				image {
					width: 200rpx;
					height: 200rpx;
					border-radius: 10rpx;
				}

			}

			.content {
				width: 65%;

				.title {
					font-size: 36rpx;
					// line-height: 50rpx;
					font-weight: bold;
				}

				.type {
					margin: 10rpx 0;
					font-size: 32rpx;
					color: #303133;
				}

				.see-btn {
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: space-between;
					margin-top: 30rpx;
				}

				.btn-coll {
					line-height: 56rpx;
					display: inline-block;
				}

				.btn_mid {
					height: 56rpx;
					width: 148rpx;
					background: #00A8F2;
					color: #fff;
					text-align: center;
					line-height: 56rpx;
					border-radius: 28rpx 28rpx 28rpx 28rpx;
				}
			}
		}

		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;

			.total-price {
				font-size: 32rpx;
			}
		}

		.bottom {
			display: flex;
			margin-top: 40rpx;
			padding: 0 10rpx;
			justify-content: space-between;
			align-items: center;

			.btn {
				line-height: 52rpx;
				width: 160rpx;
				border-radius: 26rpx;
				border: 2rpx solid $u-border-color;
				font-size: 26rpx;
				text-align: center;
				color: $u-type-info-dark;
			}

			.evaluate {
				color: $u-type-warning-dark;
				border-color: $u-type-warning-dark;
			}
		}
	}

	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;

		image {
			width: 164rpx;
			height: 164rpx;
			border-radius: 50%;
			margin-bottom: 20rpx;
		}

		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
		}
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(80vh - var(--window-top));
		width: 100%;
	}

	.swiper-box {
		flex: 1;
		// margin-bottom: 100rpx;
	}

	.swiper-item {
		height: 100%;
	}

	.ewm-box {
		width: 164rpx;
		color: #FFFFFF;
		margin: 14rpx 14rpx 0 12rpx;
	}

	.ewm-box .img-ewm {
		width: 50rpx;
		height: 50rpx;
		display: inline-block;
		padding-right: 10rpx;
		// height: 200rpx;
	}

	.ewm-box .ewm-bj {
		display: flex;
		justify-content: center;
		line-height: 50rpx;

	}

	.kyq-bs {
		color: #ffffff;
		background: #f60;
		font-size: 20rpx;
		padding: 10rpx;
		border-radius: 20rpx;
	}

	.qx-style-gg {
		padding-right: 80rpx;
	}
</style>